package com.zhuoshi.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zhuoshi.entity.User;
import com.zhuoshi.entity.UserCustom;
import com.zhuoshi.mapper.UserMapper;
import com.zhuoshi.service.UserService;

@Service("userService")
@Transactional
public class UserServiceImpl implements UserService{
	@Autowired
	private UserMapper userMapper;
	
//	显示全部用户
	public List<UserCustom> selectUserAllYao(String useraccount) throws Exception {
		
		return userMapper.selectUserAllYao(useraccount);
	}
	
//  登录认证
	public User longin(User user) throws Exception {
		
		return userMapper.login(user);
	}
	
//  添加用户
	public int addUserLiu(User user)throws Exception{
		return userMapper.insertSelective(user);
	}

	//用户删除
	public int deleteUserLiu(Integer id) {
		return userMapper.deleteByPrimaryKey(id);	
	}

	//通过id查询用户
	public User selectUserAllYao(Integer id) {
		return userMapper.selectByPrimaryKey(id);
	}
	
	//用户修改信息确认
	public int userUpdateComfirmLiu(User user) {
		return userMapper.updateByPrimaryKeySelective(user);
	}

	public List<User> selectUserAll() {
		List<User> userList = userMapper.selectUserAll();
		return userList;
	}

}
